package com.example.hzly.entity;

import javax.persistence.*;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.*;

import java.sql.Date;

@Data
@Entity
@Table(name = "story_comment")
@TableName("story_comment")
public class StoryComment {
    @Id
    @TableId(type = IdType.AUTO)
    private Long id;

    @Column(columnDefinition = "TEXT")
    private String content;

    @Column(name = "create_time")
    private Date createTime;

    private Integer likes;
    private Integer status;

    @Column(name = "story_id")
    private Long storyId;

    @Column(name = "user_id")
    private Long userId;

    @Column(name = "parent_id")
    private Long parentId; // 父评论ID，null为一级评论

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id", insertable = false, updatable = false)
    @TableField(exist = false)
    private User user;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "story_id", insertable = false, updatable = false)
    @TableField(exist = false)
    private Story story;
}